package kevin.framework.basic.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import kevin.framework.basic.dao.IFuncDao;
import kevin.framework.basic.domain.Func;

/**
 * Generate by Kevin's CodeBuilder
 **/
@Repository(value = "funcDao")
public class FuncDao extends BaseDao<Func, String> implements IFuncDao {

    public static final String SQLID_LOGIN = "login";

    public static final String SQLID_GetOperatorDesp = "getOperatorDesp";

    @Override
    public List<Func> login(String userId) throws Exception {
        List<Func> list = getSqlSession().selectList(namespace + "." + SQLID_LOGIN, userId);
        return list;
    }

    @Override
    public String getOperatorDesp(String controller, String cmd) throws Exception {
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("controller", controller);
        param.put("cmd", cmd);
        List<String> res = this.selectParamE(SQLID_GetOperatorDesp, param);
        if (res.size() == 0) {
            return null;
        }
        return String.valueOf(res.get(0));
    }

}
